package modelimplementation

import "time"

type MonthlySchedule struct {
}

func (ms *MonthlySchedule) IsLastDayOfMonth(date time.Time) bool {
	m1 := date.Month()
	m2 := date.AddDate(0,0,1).Month()

	return (m1 != m2)
}

func (ms *MonthlySchedule) IsPaydate(date time.Time) bool {
	return ms.IsLastDayOfMonth(date)
}

func (ms *MonthlySchedule) GetPayPeriodStartDate(payPeriodEndDate time.Time) time.Time {
	lastDayOfMonth := payPeriodEndDate.Day()
	firstDayOfMonth := payPeriodEndDate.AddDate(0,0,-(lastDayOfMonth - 1))
	return firstDayOfMonth
}